"""
Case Type   : 进程
Case Name   : 非连接客户端/连接客户端host字段的显示
Create At   : 2024.10.26
Owner       : l1azzzy
Description :
    1、创建兼容B库;
    2、切换至B库,查看进程
    3、清理环境
Expect      :
    1、成功
    2、成功
    3、成功
History     :
"""

import os
import unittest

from testcase.utils.Common import Common
from testcase.utils.CommonSH import CommonSH
from testcase.utils.Constant import Constant
from testcase.utils.Logger import Logger
from yat.test import Node


class OpreatorTest(unittest.TestCase):

    def setUp(self):
        self.log = Logger()
        self.log.info(f'-----{os.path.basename(__file__)} start-----')
        self.common = Common()
        self.sh_primary = CommonSH('PrimaryDbBmode')
        self.user_node = Node('PrimaryDbBmode')
        self.constant = Constant()

    def test_dolphin(self):
        text = '----step1:在B库show processlist;expect:连接客户端显示为-1----'
        self.log.info(text)
        sql_cmd = f'show processlist;'
        self.log.info(sql_cmd)
        sql_res = self.sh_primary.execut_db_sql(sql_cmd)
        self.log.info(sql_res)
        self.assertIn('-1', sql_res, '执行失败' + text)

        self.log.info(f'-----{os.path.basename(__file__)} end-----')